<!--海浪网格-->
<template>
  <div class="all" @viewappear="viewappear" @viewdisappear="viewdisappear">

    <!--菜单-->
    <SubMenu :menu="menu" :menus="menus" 
    @menuClick="menuClick" />

    <template v-if="isShow">
      <!--自定义启动-->
      <UpDefine v-if="menu == 0"
      ref="define" 
      :strategyId="strategyId" 
      :strategyName="strategyName" 
      :copyConfig="copyConfig" />

      <!--多币对启动-->
      <UpMany v-else-if="menu == 1" ref="many" 
      :strategyId="strategyId" 
      :strategyName="strategyName"
      :copyConfig="copyConfig" />
    </template>
  </div>
</template>

<script>

//组件
import SubMenu from '@/public/view/SubMenu.vue' 
import UpDefine from '@/up/UpDefine.vue' 
import UpMany from '@/up/UpMany.vue' 

//功能
import navigator from "@/_js/navigator"; 

const weexFunction = weex.requireModule('WeexFunction');

import I18N from "@/_i18n/i18n";
var T = I18N.t;

export default {

  components: {
    SubMenu,
    UpDefine,
    UpMany,
  },

  data() {
    return {
      T:T,

      strategyId:'',
      strategyName:'',

      menu: 0,
      menus:[T('自定义启动'), T('多币对模式')],
      refs:['define', 'many'],
      
      copyConfig:undefined, //复制配置
      isShow:false,
    };
  },

  mounted() {

    this.strategyId = navigator.getParam("strategyId");
    this.strategyName = navigator.getParam("strategyName");
    weexFunction.setTitle(this.strategyName);

    //复制配置
    var copyConfig = navigator.getParam("copyConfig");
    if (copyConfig) {
      this.copyConfig = copyConfig;
      this.menu = !!copyConfig.pairs ? 1 : 0;
    }
    this.isShow =true;
  },

  methods:{
    /*************************************************通信触发*/
    //完全显示
    viewappear() {
      var ref = this.refs[this.menu];
      this.$refs[ref] && this.$refs[ref].viewappear();
    },

    //完全隐藏
    viewdisappear() {
      var ref = this.refs[this.menu];
      this.$refs[ref] && this.$refs[ref].viewdisappear();
    },

    /************************************************* 按钮*/
    menuClick(index){
      this.menu = index;
    },
  }
}

</script>


<style src="@/_css/style.css"></style>
<style scoped>
</style>